package com.qixin.api.serviceimpl;


import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.qixin.api.bean.*;
import com.qixin.api.mapper.XuzuMapper;
import com.qixin.api.service.XuzuService;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 续租表 服务实现类
 * </p>
 *
 * @author 李许多
 * @since 2018-11-29
 */
@Service
public class XuzuServiceImpl extends ServiceImpl<XuzuMapper, Xuzu> implements XuzuService {
    @Override
    public ResultPage<Xuzu> selectALL(VoPage voPage) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("page", (voPage.getPage() - 1)*voPage.getLimit());
        paramMap.put("limit", voPage.getLimit());
        List<Xuzu> list = baseMapper.selectALL(paramMap);
        Integer count = baseMapper.countMyPage(paramMap );
        ResultPage<Xuzu>resultPage=new ResultPage<>();
        resultPage.setCode(0);
        resultPage.setCount(count);
        resultPage.setMsg("成功");
        resultPage.setData(list);
        return resultPage;
    }

    //续租
    @Override
    public int updateXuzu(Long carId) {
        Map map1 = new HashMap();
        map1.put("carId",carId);
        return baseMapper.updateXuzu(map1);
    }



    @Override
    public ResultPage<Xuzu> selectALL1(VoPage voPage, ComCar comCar) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("page", (voPage.getPage() - 1)*voPage.getLimit());
        paramMap.put("limit", voPage.getLimit());
        List<Xuzu> list = baseMapper.selectALL1(paramMap,comCar);
        Integer count = baseMapper.countMyPage1(paramMap );
        ResultPage<Xuzu>resultPage=new ResultPage<>();
        resultPage.setCode(0);
        resultPage.setCount(count);
        resultPage.setMsg("成功");
        resultPage.setData(list);
        return resultPage;
    }

}
